package com.nguc.ngucpractice.dao;

import com.nguc.ngucpractice.common.dao.BaseDao;
import com.nguc.ngucpractice.pojo.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryDao extends BaseDao<Category> {

    @Select("select * from categorys where parentId =#{parentId}")
    @Results(value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "category_name", property = "categoryName"),
            @Result(column = "parentId", property = "parentId")
    })
    List<Category> findCategoryListByParentId(Integer parentId);

}
